package qldc.pm.tiensu.action;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;

import javax.portlet.ActionRequest;
import javax.portlet.ActionResponse;
import javax.portlet.PortletContext;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import qldc.pm.csdl.cd90.model.NoiThuongTru;
import qldc.pm.csdl.cd90.service.NoiThuongTruLocalServiceUtil;
import qldc.pm.tiensu.constants.PrintConverter;
import qldc.pm.tiensu.constants.ThaoTacUndoRedoEnum;
import qldc.pm.tiensu.constants.TienSuConstants;
import qldc.pm.tiensu.dto.LichSuXoaAnTichDTO;
import qldc.pm.tiensu.model.DoiTuongTienSu;
import qldc.pm.tiensu.model.LichSuXoaAnTich;
import qldc.pm.tiensu.model.PhieuThongTinVeNguoiCoTienSu;
import qldc.pm.tiensu.model.TEMP_DoiTuongTienSu;
import qldc.pm.tiensu.model.TEMP_TienSu;
import qldc.pm.tiensu.model.TienSu;
import qldc.pm.tiensu.portlet.action.ReportAction;
import qldc.pm.tiensu.service.DoiTuongTienSuLocalServiceUtil;
import qldc.pm.tiensu.service.LichSuXoaAnTichLocalServiceUtil;
import qldc.pm.tiensu.service.PhieuThongTinVeNguoiCoTienSuLocalServiceUtil;
import qldc.pm.tiensu.service.TEMP_DoiTuongTienSuLocalServiceUtil;
import qldc.pm.tiensu.service.TEMP_PhieuThongTinVeNguoiCoTienSuLocalServiceUtil;
import qldc.pm.tiensu.service.TEMP_TienSuLocalServiceUtil;
import qldc.pm.tiensu.service.TienSuLocalServiceUtil;

import com.liferay.portal.kernel.exception.PortalException;
import com.liferay.portal.kernel.exception.SystemException;
import com.liferay.portal.kernel.log.Log;
import com.liferay.portal.kernel.log.LogFactoryUtil;
import com.liferay.portal.kernel.servlet.ServletResponseUtil;
import com.liferay.portal.kernel.servlet.SessionErrors;
import com.liferay.portal.kernel.servlet.SessionMessages;
import com.liferay.portal.kernel.util.Constants;
import com.liferay.portal.kernel.util.ParamUtil;
import com.liferay.portal.kernel.util.Validator;
import com.liferay.portal.model.User;
import com.liferay.portal.util.PortalUtil;
import com.report.logic.Report;

public class QuanLyNguoiCoTienSu {
	private static Log _log = LogFactoryUtil.getLog(QuanLyNguoiCoTienSu.class);

	private static SimpleDateFormat DEFAULT_DATE_FORMAT = new SimpleDateFormat("dd/MM/yyyy");

	public void capNhatTienSu(ActionRequest actionRequest,
			ActionResponse actionResponse) throws IOException {
		SessionMessages.add(actionRequest, PortalUtil.getPortletId(actionRequest) + SessionMessages.KEY_SUFFIX_HIDE_DEFAULT_ERROR_MESSAGE);

		try {
			User user = PortalUtil.getUser(actionRequest);

			String soDinhDanhCaNhan = ParamUtil.getString(actionRequest, "soDinhDanhCaNhan");
			long tienSuId = ParamUtil.getLong(actionRequest, "tienSuId");

			String maSoHoSoTienSuTuToaAn = ParamUtil.getString(actionRequest, "maSoHoSoTienSuTuToaAn");
			String nguoiTrichLuc = ParamUtil.getString(actionRequest, "nguoiTrichLuc");
			String thamPhan = ParamUtil.getString(actionRequest, "thamPhan");
			String chuThich = ParamUtil.getString(actionRequest, "chuThich");
			String hoTenVoHoacChong = ParamUtil.getString(actionRequest, "hoTenVoHoacChong");
			String hoTenCha = ParamUtil.getString(actionRequest, "hoTenCha");
			String hoTenMe = ParamUtil.getString(actionRequest, "hoTenMe");
			String moTaTienAn = ParamUtil.getString(actionRequest, "moTaTienAn");
			String toaAnXuPhat = ParamUtil.getString(actionRequest, "toaAnXuPhat");
			String diaChiToaAnXuPhat = ParamUtil.getString(actionRequest, "diaChiToaAnXuPhat");
			Date ngayToaAn = ParamUtil.getDate(actionRequest, "ngayToaAn", DEFAULT_DATE_FORMAT);
			Date ngayPhamToi = ParamUtil.getDate(actionRequest, "ngayPhamToi", DEFAULT_DATE_FORMAT);
			String toiDanh = ParamUtil.getString(actionRequest, "toiDanh");
			String banAnSo = ParamUtil.getString(actionRequest, "banAnSo");
			String hinhPhatChinh = ParamUtil.getString(actionRequest, "hinhPhatChinh");
			String hinhPhatBoSung = ParamUtil.getString(actionRequest, "hinhPhatBoSung");
			String nghiaVuDanSu = ParamUtil.getString(actionRequest, "nghiaVuDanSu");
			String anPhi = ParamUtil.getString(actionRequest, "anPhi");
			NoiThuongTru noiThuongTru = NoiThuongTruLocalServiceUtil.findBySoDinhDanhCaNhan(soDinhDanhCaNhan);
			long noiThuongTruTinhId = noiThuongTru.getTinhId();
			long noiThuongTruQuanHuyenId = noiThuongTru.getQuanHuyenId();
			long noiThuongTruPhuongXaId = noiThuongTru.getPhuongXaId();
			String noiThuongTruDiaChi = noiThuongTru.getDiaChi();
			long noiTamTruTinhId = ParamUtil.getLong(actionRequest, "noiTamTruTinhId");
			long noiTamTruQuanHuyenId = ParamUtil.getLong(actionRequest, "noiTamTruQuanHuyenId");
			long noiTamTruPhuongXaId = ParamUtil.getLong(actionRequest, "noiTamTruPhuongXaId");
			String noiTamTruDiaChi = ParamUtil.getString(actionRequest, "noiTamTruDiaChi");
			String chuThichThongTinNoiLapPhieu = ParamUtil.getString(actionRequest, "chuThichThongTinNoiLapPhieu");

			String cmd = ParamUtil.getString(actionRequest, Constants.CMD);
			String undoRedo = ParamUtil.getString(actionRequest, "undoRedo");

			DoiTuongTienSu doiTuongTienSu = DoiTuongTienSuLocalServiceUtil.findBySoDinhDanhCaNhan(soDinhDanhCaNhan);

			String message = "";

			if(cmd.equals(Constants.ADD)) {
				if(Validator.isNull(doiTuongTienSu)) {
					doiTuongTienSu = DoiTuongTienSuLocalServiceUtil.addDoiTuongTienSu(user, soDinhDanhCaNhan);
				} else {
					doiTuongTienSu.setXoaAnTich(false);
					DoiTuongTienSuLocalServiceUtil.updateDoiTuongTienSu(doiTuongTienSu);
				}

				TienSu tienSu = TienSuLocalServiceUtil.addTienSu(user,
						doiTuongTienSu.getDoiTuongTienSuId(), banAnSo,
						toaAnXuPhat, diaChiToaAnXuPhat, ngayToaAn, toiDanh,
						ngayPhamToi, false, chuThich, hinhPhatChinh,
						hinhPhatBoSung, nghiaVuDanSu, anPhi, moTaTienAn);

				PhieuThongTinVeNguoiCoTienSuLocalServiceUtil
						.addPhieu(tienSu.getTienSuId(), user.getUserId(), user.getScreenName(), maSoHoSoTienSuTuToaAn, nguoiTrichLuc,
								thamPhan,
								soDinhDanhCaNhan, chuThichThongTinNoiLapPhieu,
								hoTenVoHoacChong,
								hoTenCha,hoTenMe,noiThuongTruTinhId,
								noiThuongTruQuanHuyenId, noiThuongTruPhuongXaId,
								noiThuongTruDiaChi, noiTamTruTinhId,
								noiTamTruQuanHuyenId, noiTamTruPhuongXaId,
								noiTamTruDiaChi);

				message = "thao-tac-thuc-hien-thanh-cong";
				removeAllTempDataOfCurrentUser(user.getUserId());
			} else if(cmd.equals(Constants.EDIT)) {
				TienSu tienSu = TienSuLocalServiceUtil.findByTienSuId(tienSuId);
				PhieuThongTinVeNguoiCoTienSu phieuThongTinVeNguoiCoTienSu = PhieuThongTinVeNguoiCoTienSuLocalServiceUtil.findByTienSuId(tienSuId);

				if (Validator.isNull(undoRedo)) {
					saveTienSuHoacDoiTuongTienSuForRedoKhiXoaHoacSua(tienSu, doiTuongTienSu, phieuThongTinVeNguoiCoTienSu,Constants.EDIT,ThaoTacUndoRedoEnum.UNDO.getKey());
				} else if(undoRedo.equals(ThaoTacUndoRedoEnum.UNDO.getKey())) {
					saveTienSuHoacDoiTuongTienSuForRedoKhiXoaHoacSua(tienSu, doiTuongTienSu, phieuThongTinVeNguoiCoTienSu,Constants.EDIT,ThaoTacUndoRedoEnum.REDO.getKey());
				} else {
					removeAllTempDataOfCurrentUser(tienSu.getUserId());
				}

				TienSuLocalServiceUtil.updateTienSu(tienSuId, user,
						doiTuongTienSu.getDoiTuongTienSuId(), banAnSo,
						toaAnXuPhat, diaChiToaAnXuPhat, ngayToaAn, toiDanh,
						ngayPhamToi, false, chuThich, hinhPhatChinh,
						hinhPhatBoSung, nghiaVuDanSu, anPhi, moTaTienAn);

				if(Validator.isNotNull(phieuThongTinVeNguoiCoTienSu)) {
					PhieuThongTinVeNguoiCoTienSuLocalServiceUtil.updatePhieu(
							phieuThongTinVeNguoiCoTienSu
									.getPhieuThongTinVeNguoiCoTienSuId(),
							tienSuId, user.getUserId(), user.getScreenName(),
							maSoHoSoTienSuTuToaAn, nguoiTrichLuc, thamPhan,
							soDinhDanhCaNhan, chuThichThongTinNoiLapPhieu,
							hoTenVoHoacChong, hoTenCha, hoTenMe,
							noiThuongTruTinhId, noiThuongTruQuanHuyenId,
							noiThuongTruPhuongXaId, noiThuongTruDiaChi,
							noiTamTruTinhId, noiTamTruQuanHuyenId,
							noiTamTruPhuongXaId, noiTamTruDiaChi);
				}

				message = "thao-tac-thuc-hien-thanh-cong";
			}

			SessionMessages.add(actionRequest, message);
		} catch (Exception e) {
			_log.warn(e);
			SessionErrors.add(actionRequest, "thao-tac-thuc-hien-khong-thanh-cong");
		}

		String redirect = ParamUtil.getString(actionRequest, "redirect");
		actionResponse.sendRedirect(redirect);
	}

	public void kyDuyetDanhSachXoaAnTich(ActionRequest actionRequest,
			ActionResponse actionResponse) throws SystemException, PortalException, IOException {
		SessionMessages.add(actionRequest, PortalUtil.getPortletId(actionRequest) + SessionMessages.KEY_SUFFIX_HIDE_DEFAULT_ERROR_MESSAGE);

		try {
			User user = PortalUtil.getUser(actionRequest);

			if (Validator.isNotNull(user)) {
				String cmd = ParamUtil.getString(actionRequest, "cmd");
				 if (cmd.equals(TienSuConstants.KY_DUYET_HO_SO_XOA)) {
					String lichSuXoaAnTichIds  = ParamUtil.getString(actionRequest, "lichSuXoaAnTichIds");
					removeAllTempDataOfCurrentUser(user.getUserId());
					String[] arrIds = lichSuXoaAnTichIds.split(",");
					for (String id : arrIds){
						long lichSuXoaAnTichId = Validator.isNotNull(id) ? Long.parseLong(id):0;
						if (lichSuXoaAnTichId > 0) {
							LichSuXoaAnTichLocalServiceUtil.thucHienXoaAnTich(lichSuXoaAnTichId, user);
						}
					}
				}

				SessionMessages.add(actionRequest, "ky-duyet-danh-sach-xoa-an-tich-thanh-cong");
			} else {
				SessionErrors.add(actionRequest, "vui-long-dang-nhap");
			}
		} catch (Exception e) {
			_log.warn(e);
			SessionErrors.add(actionRequest, "thao-tac-khong-thanh-cong");
		}

		String redirect = ParamUtil.getString(actionRequest, "redirect");
		actionResponse.sendRedirect(redirect);
	}

	public void xoaAnTich(ActionRequest actionRequest,
			ActionResponse actionResponse) throws SystemException, PortalException, IOException {
		SessionMessages.add(actionRequest, PortalUtil.getPortletId(actionRequest) + SessionMessages.KEY_SUFFIX_HIDE_DEFAULT_ERROR_MESSAGE);

		try {
			User user = PortalUtil.getUser(actionRequest);

			if (Validator.isNotNull(user)) {
				String cmd = ParamUtil.getString(actionRequest, "cmd");
				if (cmd.equals(TienSuConstants.LUU)) {
					LichSuXoaAnTichDTO dto = getParam(actionRequest);
					LichSuXoaAnTichLocalServiceUtil.addHoSoXoaAnTich(dto, user.getUserId());
					SessionMessages.add(actionRequest, "tao-ho-so-xoa-an-tich-thanh-cong");
				} else if (cmd.equals(TienSuConstants.KY_DUYET_HO_SO_XOA)) {
					long lichSuXoaAnTichId = ParamUtil.getLong(actionRequest, "lichSuXoaAnTichId");
					removeAllTempDataOfCurrentUser(user.getUserId());
					LichSuXoaAnTichLocalServiceUtil.thucHienXoaAnTich(lichSuXoaAnTichId, user);
					SessionMessages.add(actionRequest, "ky-duyet-xoa-an-tich-thanh-cong");
				} else {
					//print
					long lichSuXoaAnTichId = ParamUtil.getLong(actionRequest, "lichSuXoaAnTichId");
					LichSuXoaAnTich ls = LichSuXoaAnTichLocalServiceUtil.fetchLichSuXoaAnTich(lichSuXoaAnTichId);
					LichSuXoaAnTichDTO dto = PrintConverter.convertLichSuXoaAnTichToDto(ls);
					inLichSuXoaAnTich(dto, actionRequest, actionResponse);
				}
			} else {
				SessionErrors.add(actionRequest, "vui-long-dang-nhap");
			}
		} catch (Exception e) {
			_log.warn(e);
			SessionErrors.add(actionRequest, "thao-tac-khong-thanh-cong");
		}

		String redirect = ParamUtil.getString(actionRequest, "redirect");
		actionResponse.sendRedirect(redirect);
	}

	public void xoaYeuCauXoaAnTich(ActionRequest actionRequest, ActionResponse actionResponse) throws IOException {
		SessionMessages.add(actionRequest, PortalUtil.getPortletId(actionRequest) + SessionMessages.KEY_SUFFIX_HIDE_DEFAULT_ERROR_MESSAGE);

		User user;
		try {
			user = PortalUtil.getUser(actionRequest);

			if(Validator.isNotNull(user)) {
				long lichSuXoaAnTichId = ParamUtil.getLong(actionRequest, "lichSuXoaAnTichId");
				LichSuXoaAnTich ls = LichSuXoaAnTichLocalServiceUtil.fetchLichSuXoaAnTich(lichSuXoaAnTichId);
				LichSuXoaAnTichLocalServiceUtil.deleteLichSuXoaAnTich(ls);

				SessionMessages.add(actionRequest, "xoa-ho-so-thanh-cong");
			} else {
				SessionErrors.add(actionRequest, "vui-long-dang-nhap");
			}
		} catch (Exception e) {
			_log.warn(e);
			SessionErrors.add(actionRequest, "xoa-ho-so-khong-thanh-cong");
		}

		String redirect = ParamUtil.getString(actionRequest, "redirect");
		actionResponse.sendRedirect(redirect);
	}

	public void xoaTienSu(ActionRequest actionRequest, ActionResponse actionResponse) throws IOException {
		SessionMessages.add(actionRequest, PortalUtil.getPortletId(actionRequest) + SessionMessages.KEY_SUFFIX_HIDE_DEFAULT_ERROR_MESSAGE);

		try {
			User user = PortalUtil.getUser(actionRequest);

			String undoRedo = ParamUtil.getString(actionRequest, "undoRedo");
			long tienSuId = ParamUtil.getLong(actionRequest, "tienSuId");

			TienSuLocalServiceUtil.xoaTienSu(tienSuId, undoRedo, Constants.DELETE, user);

			SessionMessages.add(actionRequest, "xoa-tien-su-thanh-cong");
		} catch (Exception e) {
			_log.warn(e);
			SessionErrors.add(actionRequest, "thao-tac-khong-thanh-cong");
		}

		String redirect = ParamUtil.getString(actionRequest, "redirect");
		actionResponse.sendRedirect(redirect);
	}

	private void inLichSuXoaAnTich(LichSuXoaAnTichDTO dto, ActionRequest request, ActionResponse response) throws IOException{
		HashMap<String, Object> data = ReportAction.createReportQuanLyLichSuXoaAnTich(dto);
		PortletContext pc = request.getPortletSession().getPortletContext();
		String reportFileName = TienSuConstants.LICH_SU_XOA_AN_TICH;
		String reportFilePath = pc
				.getRealPath(TienSuConstants.REPORT_TEMPLATE_FOLDER + "/"
						+ reportFileName + ".jrxml");

		File file = Report.createReport(data, Report.DOC_TYPE, reportFilePath,
				reportFileName);
		if (Validator.isNotNull(file)) {
			InputStream in = new FileInputStream(file);

			HttpServletRequest httpServletRequest = PortalUtil
					.getHttpServletRequest(request);
			HttpServletResponse httpServletResponse = PortalUtil
					.getHttpServletResponse(response);
			ServletResponseUtil.sendFile(httpServletRequest,
					httpServletResponse, reportFileName + "."
							+ Report.DOC_TYPE, in, Report.DOC_STREAM_TYPE);
		}

	}

	private LichSuXoaAnTichDTO getParam(ActionRequest actionRequest) {
		LichSuXoaAnTichDTO result = new LichSuXoaAnTichDTO();

		long tienSuId = ParamUtil.getLong(actionRequest, "tienSuId");
		if (tienSuId > 0 ){
			TienSu ts;
			try {
				ts = TienSuLocalServiceUtil.fetchTienSu(tienSuId);
				result.setBanAnSo(ts.getBanAnSo());
				result.setToaAn(ts.getToaAnXuPhat());
				result.setNgayToaAn(ts.getNgayToaAn());
				result.setTienSuId(tienSuId);

				String diaChi = "";

				PhieuThongTinVeNguoiCoTienSu phieu = PhieuThongTinVeNguoiCoTienSuLocalServiceUtil.findByTienSuId(ts.getTienSuId());
					if (Validator.isNotNull(phieu)){
						diaChi = Validator.isNotNull(phieu.getNoiThuongTruDiaChi()) ? phieu.getNoiThuongTruDiaChi() : phieu.getNoiTamTruDiaChi();
						result.setDiaChi(diaChi);
					}

			} catch (SystemException e) {
				System.out.println("Khong tim thay tien su "+e.getMessage());
			}
		}

		long lichSuXoaAnTichId = ParamUtil.getLong(actionRequest, "lichSuXoaAnTichId",0L);
		result.setLichSuXoaAnTichId(lichSuXoaAnTichId);

		String hoVaTenDoiTuongTienSu = ParamUtil.getString(actionRequest, "hoVaTenDoiTuongTienSu");
		result.setHoVaTenDoiTuongTienSu(hoVaTenDoiTuongTienSu);
		Date ngayYeuCauXoaAnTich = ParamUtil.getDate(actionRequest, "ngayYeuCauXoaAnTich", DEFAULT_DATE_FORMAT);
		result.setNgayYeuCauXoaAnTich(ngayYeuCauXoaAnTich);

		String nguoiYeuCauXoaAnTich = ParamUtil.getString(actionRequest, "nguoiYeuCauXoaAnTich");
		result.setNguoiYeuCauXoaAnTich(nguoiYeuCauXoaAnTich);

		String maHoSoXoaAnTich = ParamUtil.getString(actionRequest, "maHoSoXoaAnTich");
		result.setMaHoSoXoaAnTich(maHoSoXoaAnTich);

		String coQuanThiHanhAn = ParamUtil.getString(actionRequest, "coQuanThiHanhAn");
		result.setCoQuanThiHanhAn(coQuanThiHanhAn);
		String kinhGui = ParamUtil.getString(actionRequest, "kinhGui");
		result.setKinhGui(kinhGui);
		String hinhPhat = ParamUtil.getString(actionRequest, "hinhPhat");
		result.setHinhPhat(hinhPhat);
		String soQuyetDinhThiHanhAn = ParamUtil.getString(actionRequest, "soQuyetDinhThiHanhAn");
		result.setSoQuyetDinhThiHanhAn(soQuyetDinhThiHanhAn);
		Date ngayQuyetDinhThiHanhAn = ParamUtil.getDate(actionRequest, "ngayQuyetDinhThiHanhAn", DEFAULT_DATE_FORMAT);
		result.setNgayQuyetDinhThiHanhAn(ngayQuyetDinhThiHanhAn);

		return result;
	}

	private void removeAllTempDataOfCurrentUser(long userId) throws SystemException{
		TEMP_DoiTuongTienSu doiTuongTienSuTemp = TEMP_DoiTuongTienSuLocalServiceUtil.findTempDoiTuongTienSuMoiNhatByUserId(userId);
		if (Validator.isNotNull(doiTuongTienSuTemp)){
			TEMP_PhieuThongTinVeNguoiCoTienSuLocalServiceUtil.xoaAllTempPhieuByDoiTuongTienSuId(doiTuongTienSuTemp.getDoiTuongTienSuId());;
			TEMP_TienSuLocalServiceUtil.xoaAllTempTienSu(doiTuongTienSuTemp.getDoiTuongTienSuId());
			TEMP_DoiTuongTienSuLocalServiceUtil.deleteTEMP_DoiTuongTienSu(doiTuongTienSuTemp);
		}
	}

	private void saveTienSuHoacDoiTuongTienSuForRedoKhiXoaHoacSua(TienSu tienSu,
			DoiTuongTienSu doiTuongTienSu, PhieuThongTinVeNguoiCoTienSu phieu, String thaoTac, String undoRedo) throws SystemException {
		if (Validator.isNotNull(tienSu) && Validator.isNotNull(doiTuongTienSu) && Validator.isNotNull(phieu)) {
			TEMP_DoiTuongTienSu doiTuongTienSuTemp = TEMP_DoiTuongTienSuLocalServiceUtil.findBySoDinhDanhCaNhan(doiTuongTienSu.getSoDinhDanhCaNhan());
			if (Validator.isNull(doiTuongTienSuTemp)) {
				doiTuongTienSuTemp = TEMP_DoiTuongTienSuLocalServiceUtil.addTEMP_DoiTuongTienSu(doiTuongTienSu.getUserId(), doiTuongTienSu.getUserName(),doiTuongTienSu.getSoDinhDanhCaNhan(), doiTuongTienSu.getDoiTuongTienSuId());
			}
			//xoa het nhung tien su truoc do
			TEMP_PhieuThongTinVeNguoiCoTienSuLocalServiceUtil.xoaAllTempPhieuByDoiTuongTienSuId(doiTuongTienSuTemp.getDoiTuongTienSuId());
			TEMP_TienSuLocalServiceUtil.xoaAllTempTienSu(doiTuongTienSuTemp.getDoiTuongTienSuId());

			TEMP_TienSu temptiensu = TEMP_TienSuLocalServiceUtil
					.addTEMP_TienSu(tienSu.getUserId(), tienSu.getUserName(),
							doiTuongTienSuTemp.getDoiTuongTienSuId(),
							tienSu.getBanAnSo(), tienSu.getToaAnXuPhat(), "",
							tienSu.getNgayToaAn(), tienSu.getToiDanh(),
							tienSu.getNgayPhamToi(), tienSu.getXoaAnTich(),
							tienSu.getChuThich(), tienSu.getHinhPhatChinh(),
							tienSu.getHinhPhatBoSung(),
							tienSu.getNghiaVuDanSu(), tienSu.getAnPhi(),
							tienSu.getMoTaTienAn(), undoRedo, thaoTac,
							tienSu.getTienSuId());
			TEMP_PhieuThongTinVeNguoiCoTienSuLocalServiceUtil.addTEMPPhieu(
					temptiensu.getTienSuId(), temptiensu.getUserId(),
					temptiensu.getUserName(), phieu.getMaSoHoSoTienSuTuToaAn(),
					phieu.getNguoiTrichLuc(), phieu.getThamPhan(),
					phieu.getSoDinhDanhCaNhan(), phieu.getChuThich(),
					phieu.getNoiTamTruDiaChi(), phieu.getHoTenVoHoacChong(),
					phieu.getHoTenCha(), phieu.getHoTenMe(),
					phieu.getNoiThuongTruDiaChi());
		}
	}
}
